package com.zhoux.api.encode;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;

/**
 * @author taoyi
 * @version 1.0
 * @date 2021/3/17 16:56
 *
 *  本类用于测试编码转换流
 */
public class Encode_Test {
    public static void main(String[] args) {
        OutputStreamWriter out = null;

        try {
            out = new OutputStreamWriter(new FileOutputStream("1.txt"),"utf-8");
            out.write("愿你迷路到我身旁~");
            System.out.println("输出成功~");
        } catch (IOException e) {
            System.out.println("输出失败~");
            e.printStackTrace();
        }finally {
            try {
                out.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}

